﻿namespace net.zxteam.zxlang.Lexer.ParserAssemblyGenerator.Internal.ParserAssemblyGeneratorImpl
{
	using System;
	using System.IO;
	using System.Reflection;
	using System.Xml;

	internal abstract class ParserAssemblyGeneratorBase : IParserAssemblyGenerator
	{
		public Assembly Generate(string pegFileName)
		{
			using (FileStream stream = new FileStream(pegFileName, FileMode.Open, FileAccess.Read, FileShare.Read))
			{
				return Generate(stream);
			}
		}

		public Assembly Generate(Stream pegStream)
		{
			using (XmlReader reader = XmlReader.Create(pegStream))
			{
				return Generate(reader);
			}
		}

		public abstract Assembly Generate(System.Xml.XmlReader pegXmlReader);
	}

}
